package interfaces.language;

import main.InitGame;
import main.listeners.listenerClasses.LanguageListener;
import interfaces.superWidgets.InterfaceWindow;

import fileHandling.language.Lang;
import fileHandling.language.LanguageLoader;

public class LanguageWindow extends InterfaceWindow {
	
	protected Lang title;
	
	public LanguageWindow(boolean closeButton, Lang title) {
		super(closeButton, LanguageLoader.get(title));
		this.title = title;
		
		InitGame.get().addLanguageListener(new LanguageListener() {
			@Override
			public void languageChanged() {
				changeLanguage();
			}
		});
	}
	
	protected void changeLanguage() { setTitle(LanguageLoader.get(title)); }
}